Dynomotion

Group: DynoMotion Message: 15245 From: moray_cuthill Date: 12/14/2017
Subject: Slowing for soft limits and MPGs

I'm aware there's been at least a couple discussions about slowing for soft limits, and also using an MPG, but could somebody provide me with a condensed version of what works, and what's needed?


I've had a look at the AdjustSoftLimits.c file (I'm currently using 4.31i), and see it should be a relatively simple case of including that, then calling the functions via the code in AdjustSoftLimitsTest.c,


I'm also interested in the recent discussion about MPG smoothing, but how big a performance hit would adding all this be to my main init.c cause?

Or should I run a second thread to handle the soft limits and MPG smoothing?


Thanks,

Moray


Group: DynoMotion Message: 15246 From: Tom Kerekes Date: 12/14/2017
Subject: Re: Slowing for soft limits and MPGs
Hi Moray,

For adjusting soft limits all you should need to do is to add a call to CheckDistToStop(ch0); for each axis in your forever loop.  Version 4.34i should have the latest code.  This is fairly computationally intensive the typical execution time seems to be about 15us.  So several calls might exceed one time slice.  I was thinking it might make sense to only make the call for one axis per loop.  I don't think this would have much impact on the softlimit response (few hundred microseconds delay).

The 3rd order MPG Smoothing should be minimal at only several microseconds.

Regards
TK

On 12/14/2017 4:06 PM, moray.cuthill@... [DynoMotion] wrote:
 

I'm aware there's been at least a couple discussions about slowing for soft limits, and also using an MPG, but could somebody provide me with a condensed version of what works, and what's needed?


I've had a look at the AdjustSoftLimits.c file (I'm currently using 4.31i), and see it should be a relatively simple case of including that, then calling the functions via the code in AdjustSoftLimitsTest.c,


I'm also interested in the recent discussion about MPG smoothing, but how big a performance hit would adding all this be to my main init.c cause?

Or should I run a second thread to handle the soft limits and MPG smoothing?


Thanks,

Moray



Group: DynoMotion Message: 15247 From: mmurray70@hotmail.com Date: 12/14/2017
Subject: Re: Slowing for soft limits and MPGs
The only issue with soft limits is with MPG motion. As far as I know jogging and running a program from kmotioncnc will always stop properly if you exceed the limits you set in the init file. 

And to prevent the mpg from overshooting you need the AdjustSoftLimits.c file. I had a little trouble at first when running in separate threads, better to include it in your init file and add the checkdisttostop command in your forever loop. For some reason I found it worked best with this command directly after the moveexp command in the mpg program, although it probably shouldnt matter. Even after all this I would still probably give yourself a quarter inch extra room before end of mechanical travel.

Check my post on the cnczone forum for details on how Tom helped me add filters to the mpg code. It works amazing now! Its not much more complicated and big difference in performance. Everybody should be using this MPG program now. Its by far better then any of the others!
Group: DynoMotion Message: 15249 From: Moray Cuthill Date: 12/15/2017
Subject: Re: Slowing for soft limits and MPGs
Thanks guys.

I'll get all that added to my code.
I've not got the MPG wired up yet, as I'm still waiting for the final parts of that puzzle, but I've got a job that will involve being quite close to the limits, so want to get the soft limits functioning correctly, and thought I'd prepare for both at the same time.

I'll report back how things run.

Moray

On Fri, Dec 15, 2017 at 12:50 AM, mmurray70@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

The only issue with soft limits is with MPG motion. As far as I know jogging and running a program from kmotioncnc will always stop properly if you exceed the limits you set in the init file. 


And to prevent the mpg from overshooting you need the AdjustSoftLimits.c file. I had a little trouble at first when running in separate threads, better to include it in your init file and add the checkdisttostop command in your forever loop. For some reason I found it worked best with this command directly after the moveexp command in the mpg program, although it probably shouldnt matter. Even after all this I would still probably give yourself a quarter inch extra room before end of mechanical travel.

Check my post on the cnczone forum for details on how Tom helped me add filters to the mpg code. It works amazing now! Its not much more complicated and big difference in performance. Everybody should be using this MPG program now. Its by far better then any of the others!


Group: DynoMotion Message: 15424 From: Moray Cuthill Date: 3/7/2018
Subject: Re: Slowing for soft limits and MPGs
I've finally got the new control panel finished, and now need to implement the MPG.

I've got the MPG wired to channel 0 encoder input, and it counts fine on the Axis screen before I initialise things, at which point it stops counting as I'm using channel 0 for the X-axis step/dir output.
Will the encoder position be read by setting the MPG channel to 0, or do I need to configure an extra axis channel which reads encoder 0?

Thanks,
Moray

On Fri, Dec 15, 2017 at 10:57 AM, Moray Cuthill <moray.cuthill@...> wrote:
Thanks guys.

I'll get all that added to my code.
I've not got the MPG wired up yet, as I'm still waiting for the final parts of that puzzle, but I've got a job that will involve being quite close to the limits, so want to get the soft limits functioning correctly, and thought I'd prepare for both at the same time.

I'll report back how things run.

Moray

On Fri, Dec 15, 2017 at 12:50 AM, mmurray70@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

The only issue with soft limits is with MPG motion. As far as I know jogging and running a program from kmotioncnc will always stop properly if you exceed the limits you set in the init file. 


And to prevent the mpg from overshooting you need the AdjustSoftLimits.c file. I had a little trouble at first when running in separate threads, better to include it in your init file and add the checkdisttostop command in your forever loop. For some reason I found it worked best with this command directly after the moveexp command in the mpg program, although it probably shouldnt matter. Even after all this I would still probably give yourself a quarter inch extra room before end of mechanical travel.

Check my post on the cnczone forum for details on how Tom helped me add filters to the mpg code. It works amazing now! Its not much more complicated and big difference in performance. Everybody should be using this MPG program now. Its by far better then any of the others!



Group: DynoMotion Message: 15425 From: Tom Kerekes Date: 3/7/2018
Subject: Re: Slowing for soft limits and MPGs
Hi Moray,

You will need some KFLOP Axis configured as Input Mode Encoder with InputChan0=0.

By default KFLOP Axis 0 is configured in that manner.  If you reconfigure it as No Input then of course the Position will no longer update.

You can use some open loop KFLOP Axis that doesn't use the Input.  But probably less confusing if you use an unused KFLOP Axis. 

Regards
TK

On 3/7/2018 2:45 PM, Moray Cuthill moray.cuthill@... [DynoMotion] wrote:
 
I've finally got the new control panel finished, and now need to implement the MPG.

I've got the MPG wired to channel 0 encoder input, and it counts fine on the Axis screen before I initialise things, at which point it stops counting as I'm using channel 0 for the X-axis step/dir output.
Will the encoder position be read by setting the MPG channel to 0, or do I need to configure an extra axis channel which reads encoder 0?

Thanks,
Moray

On Fri, Dec 15, 2017 at 10:57 AM, Moray Cuthill <moray.cuthill@...> wrote:
Thanks guys.

I'll get all that added to my code.
I've not got the MPG wired up yet, as I'm still waiting for the final parts of that puzzle, but I've got a job that will involve being quite close to the limits, so want to get the soft limits functioning correctly, and thought I'd prepare for both at the same time.

I'll report back how things run.

Moray

On Fri, Dec 15, 2017 at 12:50 AM, mmurray70@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
 

The only issue with soft limits is with MPG motion. As far as I know jogging and running a program from kmotioncnc will always stop properly if you exceed the limits you set in the init file. 


And to prevent the mpg from overshooting you need the AdjustSoftLimits..c file. I had a little trouble at first when running in separate threads, better to include it in your init file and add the checkdisttostop command in your forever loop. For some reason I found it worked best with this command directly after the moveexp command in the mpg program, although it probably shouldnt matter. Even after all this I would still probably give yourself a quarter inch extra room before end of mechanical travel.

Check my post on the cnczone forum for details on how Tom helped me add filters to the mpg code. It works amazing now! Its not much more complicated and big difference in performance. Everybody should be using this MPG program now. Its by far better then any of the others!



Group: DynoMotion Message: 15426 From: Moray Cuthill Date: 3/8/2018
Subject: Re: Slowing for soft limits and MPGs
Attachments :
    Hi Tom,

    I would of used another encoder input, but this is my mill using a Kanalog with JP5 going to my differential driver board for running the main axes in step/dir mode, which are configured to use axis channels 0-2. My spindle encoder is already using encoder 3 (and half of 2 for the index), so my only choice is encoder 0 or 1. I've set up channel 5 to use encoder 0, and it's working, but I've got a problem with softlimits.

    When I run an axis into the softlimit, a feedhold is triggered as I'd expect, however I can't use the MPG to jog back out of the soft limit. I have to use the jog buttons on the screen.
    Any thoughts?

    The only change I've made to MMurrays code over on CNC zone (http://www.cnczone.com/forums/dynomotion-kflop-kanalog/349740-applying-acceleration-mpg-target-possible-post2127836.html#post2127836), is to remove the calls to CheckDistToStop(), as I already have them within my init.c file.

    I've attached a zip file of all my current files.

    Thanks,
    Moray

    On Thu, Mar 8, 2018 at 5:05 AM, Tom Kerekes tk@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     

    Hi Moray,

    You will need some KFLOP Axis configured as Input Mode Encoder with InputChan0=0.

    By default KFLOP Axis 0 is configured in that manner.  If you reconfigure it as No Input then of course the Position will no longer update.

    You can use some open loop KFLOP Axis that doesn't use the Input.  But probably less confusing if you use an unused KFLOP Axis. 

    Regards
    TK

    On 3/7/2018 2:45 PM, Moray Cuthill moray.cuthill@... [DynoMotion] wrote:
     
    I've finally got the new control panel finished, and now need to implement the MPG.

    I've got the MPG wired to channel 0 encoder input, and it counts fine on the Axis screen before I initialise things, at which point it stops counting as I'm using channel 0 for the X-axis step/dir output.
    Will the encoder position be read by setting the MPG channel to 0, or do I need to configure an extra axis channel which reads encoder 0?

    Thanks,
    Moray

    On Fri, Dec 15, 2017 at 10:57 AM, Moray Cuthill <moray.cuthill@...> wrote:
    Thanks guys.

    I'll get all that added to my code.
    I've not got the MPG wired up yet, as I'm still waiting for the final parts of that puzzle, but I've got a job that will involve being quite close to the limits, so want to get the soft limits functioning correctly, and thought I'd prepare for both at the same time.

    I'll report back how things run.

    Moray

    On Fri, Dec 15, 2017 at 12:50 AM, mmurray70@... [DynoMotion] <DynoMotion@yahoogroups.com> wrote:
     

    The only issue with soft limits is with MPG motion. As far as I know jogging and running a program from kmotioncnc will always stop properly if you exceed the limits you set in the init file. 


    And to prevent the mpg from overshooting you need the AdjustSoftLimits..c file. I had a little trouble at first when running in separate threads, better to include it in your init file and add the checkdisttostop command in your forever loop. For some reason I found it worked best with this command directly after the moveexp command in the mpg program, although it probably shouldnt matter. Even after all this I would still probably give yourself a quarter inch extra room before end of mechanical travel.

    Check my post on the cnczone forum for details on how Tom helped me add filters to the mpg code. It works amazing now! Its not much more complicated and big difference in performance. Everybody should be using this MPG program now. Its by far better then any of the others!